#include<cstdio>
using namespace std;
int n,l,r,ln,rn;
int main()
{
  freopen("candy.in","r",stdin);
  freopen("candy.out","w",stdout);
  scanf("%d%d%d",&n,&l,&r);
  ln=l/n;rn=r/n;
  if(rn-ln>=1) printf("%d\n",n-1);
  else printf("%d\n",r%n);
  return 0;
}
